<?php


namespace App\Models;

use Illuminate\Database\Eloquent\Model as BaseModel;

abstract class Model extends BaseModel
{
    CONST WITH_CREATE = 1;
    CONST WITH_UPDATE = 2;
    CONST WITH_CREATE_UPDATE = 3;
    CONST WITH_DELETE = 4;
    CONST WITH_CREATE_DELETE = 5;
    CONST WITH_UPDATE_DELETE = 6;
    CONST WITH_CREATE_UPDATE_DELETE = 7;

    /**
     * The "booting" method of the model.("引导"模型方法)
     * 覆盖之前/之后附加方法挂钩到模型事件。
     * @return void
     * @see \Illuminate\Database\Eloquent\Model::boot()
     */
//    public static function boot()
//    {
//        parent::boot();
//        $myself   = get_called_class();
//        $hooks    = array('before' => 'ing', 'after' => 'ed');
//        $radicals = array('sav', 'validat', 'creat', 'updat', 'delet');
//        foreach ($radicals as $rad) {
//            foreach ($hooks as $hook => $event) {
//                $method = $hook . ucfirst($rad) . 'e';
//                if (method_exists($myself, $method)) {
//                    $eventMethod = $rad . $event;
//                    self::$eventMethod(function ($model) use ($method) {
//                        return $model->$method($model);
//                    });
//                }
//            }
//        }
//    }


}



